//
//  BBYClickDetailViewController.m
//  BearSiX
//
//  Created by Tom on 16/3/26.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBYClickDetailViewController.h"
#import "BBDressFlowCell.h"
#import "BBYLookForPhotoVC.h"
@interface BBYClickDetailViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView *tableview;
@end

@implementation BBYClickDetailViewController
-(UITableView *)tableview{

    if (!_tableview) {
        _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, self.view.height)];
        _tableview.backgroundColor = BACKCOLOR;
        _tableview.delegate = self;
        _tableview.dataSource = self;
    }
    return _tableview;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"拍照礼服";
    [self.view addSubview:self.tableview];
    
    UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc]initWithTitle:@"编辑" style:(UIBarButtonItemStyleDone) target:self action:@selector(editItem:)];
    self.navigationItem.rightBarButtonItem = rightBarItem;
}
//编辑
-(void)editItem:(UIBarButtonItem *)sender{

    
}
#pragma mark -- tableview delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if (section==0) {
        return 1;
    }else{
    
        return 10;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return WINSIZEWIDTH/40;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    UIView *sectionHeadView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEWIDTH/40)];
    sectionHeadView.backgroundColor = BACKCOLOR;
;
    return sectionHeadView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section==0) {
        return WINSIZEWIDTH/7.8;
    }else{
    
        return WINSIZEWIDTH/2.6;
    }
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section==0) {

    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:nil];
    TTTAttributedLabel *lookForPhone = [[TTTAttributedLabel alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/20, 0, WINSIZEWIDTH/2, WINSIZEWIDTH/7.8)];
    lookForPhone.text = @"查看礼服图片(4张)";
    [cell.contentView addSubview:lookForPhone];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    }else{
    
        BBDressFlowCell *flowCell = [tableView dequeueReusableCellWithIdentifier:@"flowCell"];
        if (!flowCell) {
            flowCell = [[BBDressFlowCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:@"flowCell"];
        }
        if (indexPath.row==0) {
            flowCell.buView.hidden = YES;
        }else{
            flowCell.buView.hidden = NO;
        }
        if(indexPath.row == 9){
            flowCell.flowStatusView.hidden = YES;
        }else{
            flowCell.flowStatusView.hidden = NO;
        }
        flowCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return flowCell;
    }
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section==0) {
        BBYLookForPhotoVC *lookVC = [[BBYLookForPhotoVC alloc]init];
        [self.navigationController pushViewController:lookVC animated:YES];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
